package com.taxsystem.huangguangxing.commoncheck;

import com.main.taxsystem.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class CommoncheckAdapter extends BaseAdapter{
	private Context		mContext;
	// 定义整型数组 即图片源
	private Integer[]	mImageIds	= 
	{ 
			R.drawable.rdwt,
			R.drawable.sscx,
			
	};

	public CommoncheckAdapter(Context c)
	{
		mContext = c;
	}

	// 获取图片的个数
	@Override
	public int getCount()
	{
		return mImageIds.length;
	}

	// 获取图片在库中的位置
	@Override
	public Object getItem(int position)
	{
		return position;
	}


	// 获取图片ID
	@Override
	public long getItemId(int position)
	{
		return position;
	}


	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		ImageView imageView;
		if (convertView == null)
		{
			// 给ImageView设置资源
			imageView = new ImageView(mContext);
			// 设置布局 图片120×120显示
			imageView.setLayoutParams(new GridView.LayoutParams(120, 120));
			// 设置显示比例类型
			imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
		}
		else
		{
			imageView = (ImageView) convertView;
		}
		imageView.setImageResource(mImageIds[position]);		
		return imageView;
	}

}
